package com.taotao.portal.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.TaotaoResult;
import com.taotao.common.utils.ExceptionUtil;
import com.taotao.portal.service.StaticPageService;

@Controller
public class StaticPageController {
	@Autowired
	private StaticPageService staticPageService;
    /**
     * 通过freemarker发布生成商品静态页面的服务
     * @param itemId
     * @return
     * @author: JSJ
     */
	@ResponseBody
	@RequestMapping("/gen/item/{itemId}")
	public TaotaoResult getItemHtml(@PathVariable long itemId) {
		TaotaoResult result;
		try {
			result = staticPageService.getItemHtml(itemId);
		} catch (Exception e) {
			e.printStackTrace();
			return TaotaoResult.build(500, ExceptionUtil.getStackTrace(e));
		}
		return result;
	}
}
